getUnusedAppRestrictionsStatus
open fun getUnusedAppRestrictionsStatus(@NonNull context: Context): ListenableFuture<Integer>(source)
Returns the status of Unused App Restrictions for the current application. In other words, whether the features are available and if so, enabled for the application. The returned value is a ListenableFuture with an Integer corresponding to a value in UnusedAppRestrictionsConstants. The possible values are as follows:
- ERROR: an error occurred when fetching the availability and status of Unused App Restrictions. Check the logs for the reason (e.g. if the app's target SDK version <30 or the user is in locked device boot mode).
- FEATURE_NOT_AVAILABLE: there are no available Unused App Restrictions for this app.
- DISABLED: any available Unused App Restrictions on the device are disabled for this app.
- API_30_BACKPORT: Unused App Restrictions introduced by Android API 30, and since made available on earlier (API 23-29) devices are enabled for this app: permission auto-reset.
- API_30: Unused App Restrictions introduced by Android API 30 are enabled for this app: permission auto-reset.
- API_31: Unused App Restrictions introduced by Android API 31 are enabled for this app: permission auto-reset and app hibernation.
- SDK 31 and above, if isAutoRevokeWhitelisted is true, this API will return DISABLED. Else, it will return API_31.
- SDK 30, if isAutoRevokeWhitelisted is true, this API will return DISABLED. Else, it will return API_30.
- SDK 23 through 29, if there exists an app with the Verifier role that can resolve the
Intent.ACTION_AUTO_REVOKE_PERMISSIONS
action, then this API will return API_30_BACKPORT if Unused App Restrictions are enabled and DISABLED if disabled. Else, it will return FEATURE_NOT_AVAILABLE. - SDK 22 and below, this method always returns FEATURE_NOT_AVAILABLE as runtime permissions did not exist yet.